<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="${APP_PATH}/js/jquery-1.11.1.min.js"></script>
<link href="${APP_PATH}/js/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- 可选的Bootstrap主题文件（一般不使用） -->
<script src="${APP_PATH}/js/bootstrap/css/bootstrap-theme.min.css"></script>
<link rel="stylesheet" href="${APP_PATH}/js/laypage/skin/laypage.css" media="all">
<script src="${APP_PATH}/js/laypage/laypage.js"></script>
<link rel="stylesheet" type="text/css" href="${APP_PATH}/mycss/style.css" />
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${APP_PATH}/js/bootstrap/js/bootstrap.min.js"></script>
<title>Insert title here</title>
</head>
<body id="tablePage">
<div>
		<blockquote>
			<p class="twoType">角色管理</p>
		</blockquote> 	
		<hr/>
	<div class="btnChange">
		<select style="width:118px;margin-left:-100;height:25px" onchange="A()" id="getoption" name="getoption">
			<option  value="商品名称">商品名称</option>
			<option value="商品编号">商品编号</option>
			<option value="订单号">订单号</option>
			<option value="收货人">收货人</option>
		</select>
		<input class="btn btn-default addBtn" type="text" name="QueryConditions" id="QueryConditions" />
		<input class="btn btn-default" type="button" id="order02Button" value="查询" />
	</div>
	<div class="tableDiv" id="aaaaaaaaaaaaaaaa">
		<form action="" >
		<table id="conTable" class="table table-bordered">
			<thead>
				<tr class="info"><td></td><td></td><td>订单号</td><td>商品</td><td>收货人</td><td>订单金额</td><td>下单时间</td><td>操作</td></tr>
			</thead>
			<!-- <tr class="active"><td></td><td><input type="radio" name="radio" /></td><td>2</td><td>挖掘机,推土机</td><td>张三</td><td>￥200000</td><td>2013、</td><td><input class="btn btn-info btn-xs active" type="button" value="查看">&nbsp;&nbsp;<input class="btn btn-warning btn-xs active" type="button" value="提交"></td></tr>
			<tr class="active"><td></td><td><input type="radio" name="radio" /></td><td>角色名称</td><td>所属部门</td><td>最后修改时间</td><td>操作人</td><td>备注说明</td><td><input type="button" value="查看">&nbsp;&nbsp;<input type="button" value="提交"></td></tr>
			<tr class="active"><td></td><td><input type="radio" name="radio" /></td><td>角色名称</td><td>所属部门</td><td>最后修改时间</td><td>操作人</td><td>备注说明</td><td><input type="button" value="查看">&nbsp;&nbsp;<input type="button" value="提交"></td></tr>
			<tr class="active"><td></td><td><input type="radio" name="radio" /></td><td>角色名称</td><td>所属部门</td><td>最后修改时间</td><td>操作人</td><td>备注说明</td><td><input type="button" value="查看">&nbsp;&nbsp;<input type="button" value="提交"></td></tr> -->							
			<tbody id="automaticOrder02">
			</tbody>
			<tfoot><tr><td colspan="5"><div id="reviewfenye"></div></td></tr></tfoot>
		</table>
	</form>
	</div>
	
	<!--新增页面开始-->
	<div class="modal fade" id="addUser" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">新 增</h4>
				</div>
				<form class="form-horizontal" role="form" id="addUserForm"
					action="" method="post" >
					<div class="modal-body">
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">订单编号：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrCusId" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">客户 姓名：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrName" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">客户 性别：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrSex" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">客户类型：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrSuckers" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">订单总金额：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrTotalConsumptionAmount" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">支付方式：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrModelPayment" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">配送方式：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrDeliveryMode" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">送货地址：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrAddress" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">联系电话：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrPhone" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">下单时间：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getOrDate" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">处理人：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getEmpName" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">处理人所属部门：
							</label>
							<div class="col-sm-9">
								<input type="text" class=" sortNumber form-control"
									id="getDeptName" style="width: 250px" readonly="readonly" />
							</div>
						</div>
						
						<div class="form-group">
							<table class="table table-bordered">
								<thead>
									<tr class="info"><td>商品编号</td><td>商品名称</td><td>商品型号</td><td>商品单价</td><td>数量</td></tr>
								</thead>
								<tbody id="automaticOrder02Tbody">
								</tbody>
							</table>
							
						</div>
					
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭
							</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<!-- /.modal-content -->
</div>
<script type="text/javascript">
var currentpage = 1;
var getoption = "1";
var QueryConditions = "2";
//条件查询部分
function listByCondition (getoption,QueryConditions,currentpage) {
	
	$.ajax({
		type:"POST",
		url:"${APP_PATH}/orderManagement/OrderQuery/automaticOrder02",
		data:{"getoption":getoption,"QueryConditions":QueryConditions,"currentpage":currentpage},
		dataType:"json",
		success:function(data){
			console.log(data.listOrder02);
			$("#automaticOrder02").html("");
			$.each(data.listOrder02,function(i,item){
  				$("#automaticOrder02").append("<tr class='active' style='width:50px;'><td>"+ ++i+"</td><td><input type='checkbox' id='checkall' name='checkall'/></td><td>"+
  				item.orCusId+"</td><td>"+
  				item.orderMerchandises+"</td><td>"+
  				item.orName+"</td><td>"+
  				item.orTotalConsumptionAmount+"</td><td>"+
  				item.orDate+"</td><td><input type='button' onclick='order02ToView("+
  				item.orCusId+")' value='查看'></td></tr>");
			});
			laypage({
				 cont:'reviewfenye',//容器
			     pages:data.pages, //总页数
			     //limit:2,//每页显示的条数
			     curr:currentpage,//当前页
			     skin:'molv',//皮肤
			     skip:true,//
			     last:'尾页',//
			     jump:function(obj,first){		
			    	 currentpage=obj.curr;
			    	     if(!first){
			    	    	 listByCondition(obj.curr);
			    	    	 }
			     }
			});
		}
	})
}	
//页面自动加载
$(document).ready(function(){
	listByCondition(getoption,QueryConditions,currentpage);
})
$(document).delegate('#order02Button', 'click', function(){
	getoption = $("#getoption option:selected").val();
	QueryConditions = $("#QueryConditions").val();
	listByCondition(getoption,QueryConditions,currentpage);
})
//点击查看按钮
function order02ToView(orCusId){
	$('#addUser').modal('show');
	$.ajax({
		type:"POST",
		url:"${APP_PATH}/orderManagement/OrderQuery/order02ToView",
		data:{"orCusId":orCusId},
		dataType:"json",
		success:function(data){
			$("#getOrCusId").val(data.orCusId);
			$("#getOrName").val(data.orName);
			$("#getOrSex").val(data.orSex);
			$("#getOrSuckers").val(data.orSuckers);
			$("#getOrTotalConsumptionAmount").val(data.orTotalConsumptionAmount);
			$("#getOrModelPayment").val(data.orModelPayment);
			$("#getOrDeliveryMode").val(data.orDeliveryMode);
			$("#getOrAddress").val(data.orAddress);
			$("#getOrPhone").val(data.orPhone);
			$("#getOrDate").val(data.orDate);
			$("#getEmpName").val(data.empName);
			$("#getDeptName").val(data.deptName);
			/* $("#automaticOrder02").html(""); */
			$.each(data.listOrderMerchandise,function(i,item){
				$("#automaticOrder02Tbody").append("<tr><td>"+
					item.orMerId+"</td><td>"+
	  				item.orMerName+"</td><td>"+
	  				item.orMerModelNumber+"</td><td>"+
	  				item.orMerPrice+"</td><td>"+
	  				item.orNumber+"</td></tr>");
			});
		}
	});
}
</script>
</body>
</html>